<?php
class AdminController extends Zend_Controller_Action{
	function init(){
// 		$auth = Zend_Auth::getInstance();
// 		$infoUser = $auth->getIdentity();
// 		if($infoUser->role !=1)
// 			$this->_redirect('/index/index');
	}
	
	public function preDispatch() {
		$auth = Zend_Auth::getInstance ();
		$infoUser = $auth->getIdentity();
		if (! $auth->hasIdentity ()) { //Nếu chưa đăng nhập
			if ($this->_request->getActionName () != 'dangnhap') {//Nếu action hiện tại không phải action login
				$this->_redirect ( '/user/dangnhap' );//Chuyển đến trang login
			}
		}elseif($infoUser->role !=1 && $this->_request->getActionName () != 'warning')//Nếu đã đăng nhập nhưng ko phải admin
				$this->_redirect('/admin/warning');
	}
	
	
	public function indexAction()
	{
		
	}
	public function customermanagerAction()
	{
		$data= new Application_Model_KhachHang();
		$this->view->khachhang=$data->fetchAll();
	}
	public function customerdetailAction()
	{
		$id=$this->_request->getParam('id_kh');
		$kh= new Application_Model_KhachHang();
		$this->view->khdetail=$kh->getKhachHang($id);
	}
	public function setsatecustomerAction()
	{
		
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		try{
			$id=$this->_request->getParam('id_kh');
			$kh= new Application_Model_KhachHang();
			$data=$kh->getKhachHang($id);
			if($data['trangthai']==1)
				$data['trangthai']=2;
			else
				$data['trangthai']=1;
			$kh->updateCI($data);
			$this->_redirect('admin/customermanager');
			
			
		}catch (Exception $ex)
		{
			echo 'Cannot update customer information, Error :'.$ex->getMessage();
		}
	}
	
	public function flowermanagerAction(){
		$giohoa=new Application_Model_GioHoa();
		$this->view->giohoa=$giohoa->fetchAll();
	}
	public function flowerdetailAction(){
		$id=$this->_request->getParam('id_sp');
		$data=new Application_Model_CTGioHoa();
		$this->view->flowerdetail=$data->getListCTGioHoa($id);
		$tenhoa=array();
		$hoadata=new Application_Model_Hoa();
		foreach ($data->getListCTGioHoa($id) as $ctgiohoa)
		{
			$hoaid=$ctgiohoa['hoa_id'];
			$hoa=$hoadata->getHoa($hoaid);
			$tenhoa[$hoaid]=$hoa['tenhoa'];
		}
		$this->view->tenhoa=$tenhoa;
		$this->view->idsp=$id;
	}
	
	public function addflowerdetailAction(){
		$id=$this->_request->getParam('id_sp');
		$giohoadata=new Application_Model_GioHoa();
		$giohoa=$giohoadata->getGioHoa($id);
		$tengiohoa=$giohoa['tengiohoa'];
		$form=new Application_Form_AddFlowerDetail();
		$form->settengiohoa($tengiohoa);
		$this->view->formadd_detail=$form;
		//xử lí việc thêm một chi tiết giỏ hoa		
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if ($form->isValid($formData)) {
				$hoa_id=$form->getValue('hoa_id');
				$slhoa=$form->getValue('slhoa');
				$ct= new Application_Model_CTGioHoa();
				$ct->addCTGioHoa($hoa_id, $id, $slhoa);
				$this->_redirect('admin/flowerdetail/id_sp/'.$id);
			} else {
				$form->populate($formData);
			}
		}
	}
	
	public function editflowerdetailAction(){
		$hoa_id=$this->_request->getParam('hoa_id');
		$giohoa_id=$this->_request->getParam('id_sp');
		$form=new Application_Form_EditFlowerDetail();
		$hoadata=new Application_Model_Hoa();
		$mothoa=$hoadata->getHoa($hoa_id);
		$giohoadata=new Application_Model_GioHoa();
		$motgiohoa=$giohoadata->getGioHoa($giohoa_id);
		$form->settengiohoa_tenhoa($motgiohoa['tengiohoa'], $mothoa['tenhoa']);
		$this->view->formedit_detail=$form;
		//xử lí thay đổi số lượng hoa
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if ($form->isValid($formData)) {
				$formData['hoa_id']=$hoa_id;
				$formData['giohoa_id']=$giohoa_id;
				unset($formData['tengiohoa']);
				unset($formData['tenhoa']);
				unset($formData['submit']);
				$ct= new Application_Model_CTGioHoa();
				$ct->updateCTGioHoa($formData);
				$this->_redirect('admin/flowerdetail/id_sp/'.$giohoa_id);
			} else {
				$form->populate($formData);
			}
		}
	}
	
	public function deleteflowerdetailAction(){
		$hoa_id=$this->_request->getParam('hoa_id');
		$giohoa_id=$this->_request->getParam('id_sp');
		$ct_giohoa=new Application_Model_CTGioHoa();
		$ct_giohoa->deleteCTGioHoa($hoa_id, $giohoa_id);
		$this->_redirect('admin/flowerdetail/id_sp/'.$giohoa_id);
	}
	
	public function editflowerAction(){
		$id=$this->_request->getParam('id_sp');
		$giohoa= new Application_Model_GioHoa();
		$data=$giohoa->getGioHoa($id);
		$form=new Application_Form_EditFlower();
		$form->setDescription('Form sửa thông tin giỏ hoa');
		$this->view->formedit=$form;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					$loaigiohoa_id = $form->getValue('loai_id');
					if(!empty($loaigiohoa_id))
						$data['loaigiohoa_id']=$loaigiohoa_id;
					$tengiohoa = $form->getValue('tengiohoa');
					if(!empty($tengiohoa))
						$data['tengiohoa']=$tengiohoa;
					$dongiaban=$form->getValue('dongiaban');
					if(!empty($dongiaban))
					{
						$data['dongiaban']=$dongiaban;
						$giacu=$giohoa->getGiaById($id);
						if((int)$data['dongiaban']!=(int)$giacu)
							$data['tiencongphuthu']+=($data['dongiaban']-$giacu);
					}
					$slton=$form->getValue('slton');
					if(!empty($slton))
						$data['slton']=$slton;
					$imagename=$form->getValue('img_url');
					if(!empty($imagename))
						$data['img_url']=$imagename;
					$giohoa->updateGiohoabyarray($data);
					$this->_helper->redirector('flowermanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot update flower . Error :'.$ex->getMessage();		
			}
		}else {
     			$form->populate($data);
     	}
	}
/**/
	public function addflowerAction(){
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			$tongtienhoa=0;
			$hoa_table=new Application_Model_Hoa();
			foreach ($formData as $key=>$value){
				if((int)$key>0)
				{
					$hoa=$hoa_table->gethoa($key);
					$tongtienhoa+=($value*$hoa['dongia']);
				}
			}
			if(is_numeric($formData['dongiaban'])||is_numeric($formData['slton']))
			{
				$loaigiohoa_id = $formData['loai_id'];
				$tengiohoa = $formData['tengiohoa'];
				$dongiaban=$formData['dongiaban'];
				$slton=$formData['slton'];
				$flag=0;
				$imagename=$formData['img_url'];
				if((int)$dongiaban<$tongtienhoa)
				{
					echo "<script>alert('đơn giá bán phải lớn hơn tổng tiền hoa!!!')</script>";
				}
				else
				{
					$tiencong=(int)$dongiaban-$tongtienhoa;
					$giohoa= new Application_Model_GioHoa();
					$giohoa->addGioHoa($loaigiohoa_id, $tengiohoa, $dongiaban, $slton, $flag, $imagename,$tiencong);
					//tạo các chi tiết giỏ hoa ở đây (dùng hàm insertCTGioHoa)
					$giohoa_id=$giohoa->getLastID();
					$ctgiohoa_table=new Application_Model_CTGioHoa();
					foreach ($formData as $key=>$value){
						if((int)$key>0)
						{
							if($value>0)
								$ctgiohoa_table->insertCTGioHoa($key, $giohoa_id, $value);
						}
					}
					//quay về trang quản lí giỏ hoa
					$this->_helper->redirector('flowermanager');
				}
			}else{
				echo "<script>alert('đơn giá bán và số lượng tồn phải là kiểu số!!!')</script>";
			}
		}
	}
	
	public function tinhtientonghoaAction(){
		$this->_helper->layout->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$hoa_table=new Application_Model_Hoa();
		$hoa_id=$this->_request->getParam('hoa_id');
		$slhoa=$this->_request->getParam('slhoa');
		$hoa=$hoa_table->getHoa($hoa_id);
		$dongia=$slhoa*$hoa['dongia'];
		$json = Zend_Json::encode ( $dongia );//Chuyển sang kiểu json
		print_r ( $json );
	}
	public function deleteflowerAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		try{
			$flower= new Application_Model_GioHoa();
			$id=$this->_request->getParam('id_sp');
			$flower->deleteGioHoa($id);
			$this->_helper->redirector('flowermanager');
		}catch (Exception $ex)
		{
			echo 'Cannot delete flower'.$id.'  .Error :'.$ex->getMessage();
		}
	}
	
	public function setflagflowerAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		try{
			$id=$this->_request->getParam('id_sp');
			$sp= new Application_Model_GioHoa();
			$data=$sp->getGioHoa($id);
			if($data['flag']==1)
				$data['flag']=0;
			else 
				$data['flag']=1;
			$sp->updateGiohoabyarray($data);
			$this->_redirect('admin/flowermanager');
		}catch (Exception $ex)
		{
			echo 'Cannot update flower information, Error :'.$ex->getMessage();
		}
	}
	
	public function odermanagerAction(){
		$ddh= new Application_Model_DonDatHang();
		$data= $ddh->fetchAll()->toArray();
		$this->view->dondathang=$data;
	}
	public function oderdetailAction(){
		$ct_ddh= new Application_Model_CTDonDatHang();
		$id=$this->_request->getParam('id_ddh');
		$data=$ct_ddh->getListCTDonDatHang($id);
		$this->view->ddhlist=$data;
		$giohoa=new Application_Model_GioHoa();
		$tengiohoa=array();
		foreach($data as $value)
		{
			$motgiohoa=$giohoa->getGioHoa($value['giohoa_id']);
			$tengiohoa[$value['giohoa_id']]=$motgiohoa['tengiohoa'];
		}
		$this->view->listtengiohoa=$tengiohoa;
		$this->view->id_dondathang=$id;
	}
	public function deleteoderAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		try{
			$ddh= new Application_Model_DonDatHang();
			$id=$this->_request->getParam('id_ddh');
			$ddh->deleteDonDatHang($id);
			$this->_helper->redirector('odermanager');
		}catch (Exception $ex)
		{
			echo 'Cannot delete oder'.$id.'  .Error :'.$ex->getMessage();
		}
	}
	public function  updatestausAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$ddh= new Application_Model_DonDatHang();
		$id=$this->_request->getParam('id_ddh');
		$ddh->updateDonDatHang($id);
		$this->_helper->redirector('odermanager');
	}
	
	public function materialmanagerAction(){
		$hoa_table=new Application_Model_Hoa();
		$hoa_data=$hoa_table->fetchAll()->toArray();
		$this->view->listmaterial=$hoa_data;
	}
	
	public function editmaterialAction(){
		$id=$this->_request->getParam('hoa_id');
		$hoa_table=new Application_Model_Hoa();
		$giohoa_table=new Application_Model_GioHoa();
		$ctgiohoa_table=new Application_Model_CTGioHoa();
		$data=$hoa_table->getHoa($id);
		$form=new Application_Form_EditMaterial();
		$form->setDescription('Form sửa thông tin hoa');
		$this->view->formedit_material=$form;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					$hoa=$hoa_table->getHoa($id);
					$giathaydoi=$formData['dongia']-$hoa['dongia'];
					$hoa_table->updateHoa($id, $formData['tenhoa'],$formData['dongia']);
					//cập nhật giá giỏ hoa
					$list_ctgiohoa=$ctgiohoa_table->getListctgiohoaByhoaid($id);
					foreach ($list_ctgiohoa as $oneitem)
					{
						$motgiohoa=$giohoa_table->getGioHoa($oneitem['giohoa_id']);
						$gia=$motgiohoa['dongiaban']+($giathaydoi*$oneitem['slhoa']);
						$giohoa_table->updateGiaGioHoa($motgiohoa['id'], $gia);
					}
					$this->_helper->redirector('materialmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot update material . Error :'.$ex->getMessage();
			}
		}else {
			$form->populate($data);
		}
	}
	
	public function addmaterialAction(){
		$form=new Application_Form_EditMaterial();
		$this->view->formadd_material=$form;
		$hoa_table=new Application_Model_Hoa();
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					$hoa_table->addHoa($formData['tenhoa'],$formData['dongia']);
					$this->_helper->redirector('materialmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot add material . Error :'.$ex->getMessage();
			}
		}
	}
	
	public function deletematerialAction(){
		$hoa_id=$this->_request->getParam('hoa_id');
		$hoa_table=new Application_Model_Hoa();
		$ctgiohoa_table=new Application_Model_CTGioHoa();
		$list_ctgiohoa=$ctgiohoa_table->getListctgiohoaByhoaid($hoa_id);
		foreach ($list_ctgiohoa as $oneitem){
			$giohoa_id=$oneitem['giohoa_id'];
			$ctgiohoa_table->deleteCTGioHoa($hoa_id, $giohoa_id);
		}
		$hoa_table->deleteHoa($hoa_id);
		$this->_helper->redirector('materialmanager');
	}
	
	public function viewcustomoderAction(){
		$ddh_id=$this->_request->getParam('ddh_id');
		$giohoa_id=$this->_request->getParam('giohoa_id');
		$yeucauthaydoi_table=new Application_Model_PhieuYeuCauThayDoi();
		$this->view->list_yeucauthaydoi=$yeucauthaydoi_table->getListPhieuYeuCauThayDoi($ddh_id, $giohoa_id);
	}
	
	public function categorymanagerAction(){
		$loaigiohoa=new Application_Model_LoaiGioHoa();
		$this->view->category=$loaigiohoa->fetchAll();
	}
	public function viewcategorydetailAction(){
		$loai_id=$this->_request->getParam('loai_id');
		$giohoa_table=new Application_Model_GioHoa();
		$giohoa_data=$giohoa_table->getGioHoaByCategory($loai_id);
		$this->view->detailcategory=$giohoa_data;
		$this->view->detailcategoryid=$loai_id;
	}
	
	public function deleteallflowerofcategoryAction(){
		$loai_id=$this->_request->getParam('loai_id');
		$giohoa_table=new Application_Model_GioHoa();
		$giohoa_data=$giohoa_table->getGioHoaByCategory($loai_id);
		foreach ($giohoa_data as $motgiohoa){
			$giohoa_table->deleteGioHoa($motgiohoa['id']);
		}
		$this->_helper->redirector('categorymanager');
	}
	public function editcategoryAction(){
		$loai_id=$this->_request->getParam('loai_id');
		$loai_table=new Application_Model_LoaiGioHoa();
		$loai=$loai_table->getLoaiGioHoa($loai_id);
		$form=new Application_Form_EditCategory();
		$form->populate($loai);
		$this->view->formeditcategory=$form;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if ($form->isValid($formData)) {
				$loai_table->updateLoaiGioHoa($loai_id, $formData['tenloai']);
				$this->_helper->redirector('categorymanager');
			} else {
				$form->populate($formData);
			}
		}
	}
	
	public function deletecategoryAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$loai_id=$this->_request->getParam('loai_id');
		$loai_table=new Application_Model_LoaiGioHoa();
		$loai_table->deleteLoaiGioHoa($loai_id);
		$this->_helper->redirector('categorymanager');
	}
	
	public function addcategoryAction(){
		$loai_table=new Application_Model_LoaiGioHoa();
		$form=new Application_Form_EditCategory();
		$this->view->formaddcategory=$form;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			if ($form->isValid($formData)) {
				$loai_table->addLoaiGioHoa($formData['tenloai']);
				$this->_helper->redirector('categorymanager');
			} else {
				$form->populate($formData);
			}
		}
	}
	
	public function addflowerforacategoryAction(){
		$valueid=$this->_request->getParam('loai_id');
		$loai_table=new Application_Model_LoaiGioHoa();
		$loai=$loai_table->getLoaiGioHoa($valueid);
		$this->view->ten_loai_add=$loai;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			$tongtienhoa=0;
			$hoa_table=new Application_Model_Hoa();
			foreach ($formData as $key=>$value){
				if((int)$key>0)
				{
					$hoa=$hoa_table->gethoa($key);
					$tongtienhoa+=($value*$hoa['dongia']);
				}
			}
			if(is_numeric($formData['dongiaban'])||is_numeric($formData['slton']))
			{
				$loaigiohoa_id = $valueid;
				$tengiohoa = $formData['tengiohoa'];
				$dongiaban=$formData['dongiaban'];
				$slton=$formData['slton'];
				$flag=1;
				$imagename=$formData['img_url'];
				if((int)$dongiaban<$tongtienhoa)
				{
					echo "<script>alert('đơn giá bán phải lớn hơn tổng tiền hoa!!!')</script>";
				}
				else
				{
					$tiencong=(int)$dongiaban-$tongtienhoa;
					$giohoa= new Application_Model_GioHoa();
					$giohoa->addGioHoa($loaigiohoa_id, $tengiohoa, $dongiaban, $slton, $flag, $imagename,$tiencong);
					//tạo các chi tiết giỏ hoa ở đây (dùng hàm insertCTGioHoa)
					$giohoa_id=$giohoa->getLastID();
					$ctgiohoa_table=new Application_Model_CTGioHoa();
					foreach ($formData as $key=>$value){
						if((int)$key>0)
						{
							if($value>0)
								$ctgiohoa_table->insertCTGioHoa($key, $giohoa_id, $value);
						}
					}
					//quay về trang quản lí giỏ hoa
					$this->_redirect('admin/viewcategorydetail/loai_id/'.$valueid);
				}
			}else{
				echo "<script>alert('đơn giá bán và số lượng tồn phải là kiểu số!!!')</script>";
			}
		}
	}
	
	public function categorynewmanagerAction(){
		$loaibaiviet_table=new Application_Model_LoaiBaiViet();
		$this->view->categorynew=$loaibaiviet_table->fetchAll();
	}
	
	public function viewcategorynewdetailAction(){
		$loai_id=$this->_request->getParam('loai_id');
		$baiviet_table=new Application_Model_BaiViet();
		$baiviet_data=$baiviet_table->getBaiVietByLoaiId($loai_id);
		$this->view->detailcategorynew=$baiviet_data;
		$this->view->detailcategorynewid=$loai_id;
	}
	
	public function setactiAction(){
		$id=$this->_request->getParam('id_bv');
		$loai_id=$this->_request->getParam('loai_id');
		$baiviet_table=new Application_Model_BaiViet();
		$baiviet_data=$baiviet_table->getBaiViet($id);
		if($baiviet_data['acti'])
		{
			$baiviet_data['acti']=0;
			$baiviet_table->updateBaiViet($baiviet_data);
			
		}else
		{
			$baivietacti=$baiviet_table->getBaiVietActive($loai_id);
			$baivietacti[0]['acti']=0;
			$baiviet_table->updateBaiViet($baivietacti[0]);
			$baiviet_data['acti']=1;
			$baiviet_table->updateBaiViet($baiviet_data);
		}
		$this->_redirect('admin/categorynewmanager');
	}
	
	public function deletebaivietAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$id=$this->_request->getParam('id_bv');
		$baiviet_table=new Application_Model_BaiViet();
		$baiviet_table->deleteBaiViet($id);
		$this->_redirect('admin/categorynewmanager');
	}
	
	public function addnewsforacategoryAction(){
		$form=new Application_Form_AddNews();
		$this->view->formaddbaiviet=$form;
		$baiviet_table=new Application_Model_BaiViet();
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					unset($formData['submit']);
					$baiviet_table->addBaiViet($formData);
					$this->_helper->redirector('categorynewmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot add news . Error :'.$ex->getMessage();
			}
		}
	}
	
	public function editbaivietAction() {
		$baiviet_table=new Application_Model_BaiViet();
		$id=$this->_request->getParam('id_bv');
		$baiviet_data=$baiviet_table->getBaiViet($id);
		$form=new Application_Form_AddNews();
		$this->view->formeditbaiviet=$form;
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					unset($formData['submit']);
					$baiviet_table->updateBaiViet($formData);
					$this->_helper->redirector('categorynewmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot add news . Error :'.$ex->getMessage();
			}
		}
		else{
			$form->populate($baiviet_data);
		}
	}
	
	public function addcategorynewsAction(){
		$form=new Application_Form_AddCategoryNews();
		$this->view->formaddcategorynews=$form;
		$loaibaiviet_table=new Application_Model_LoaiBaiViet();
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					$loaibaiviet_table->addLoaiBaiViet($formData['tenloai']);
					$this->_helper->redirector('categorynewmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot add category news . Error :'.$ex->getMessage();
			}
		}
	}
	
	public function editcategorynewAction(){
		$form=new Application_Form_AddCategoryNews();
		$this->view->formeditcategorynews=$form;
		$loaibaiviet_table=new Application_Model_LoaiBaiViet();
		$id=$this->_request->getParam('loai_id');
		$loaibaiviet_data=$loaibaiviet_table->getLoaiBaiViet($id);
		if($this->getRequest()->isPost())
		{
			$formData = $this->getRequest()->getPost();
			try {
				if ($form->isValid($formData)) {
					$loaibaiviet_table->updateLoaiBaiViet($id, $formData['tenloai']);
					$this->_helper->redirector('categorynewmanager');
				} else {
					$form->populate($formData);
				}
			}catch (Exception $ex)
			{
				echo 'Cannot add category news . Error :'.$ex->getMessage();
			}
		}
		else{
			$form->populate($loaibaiviet_data);
		}
	}
	
	public function deletecategorynewAction(){
		$this->_helper->layout()->disableLayout();
		$this->_helper->viewRenderer->setNoRender(true);
		$loaibaiviet_table=new Application_Model_LoaiBaiViet();
		$id=$this->_request->getParam('loai_id');
		$loaibaiviet_table->deleteLoaiBaiViet($id);
		$this->_helper->redirector('categorynewmanager');
	}
	
	public function noticeAction(){
		
	}
	
	public function warningAction()
	{
		$this->view->message = "Bạn không được phép truy cập trang này!";
	}
}